package com.fanxuankai.boot.jenkins.autoconfigure;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.List;
import java.util.Map;

/**
 * @author fanxuankai
 */
@ConfigurationProperties(prefix = JenkinsSyncProperties.PREFIX)
public class JenkinsSyncProperties {
    public static final String PREFIX = JenkinsProperties.PREFIX + ".sync";
    public static final String ENABLED = PREFIX + ".enabled";

    /**
     * 开关
     */
    private boolean enabled;
    /**
     * item 列表
     */
    private List<Item> items;

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public List<Item> getItems() {
        return items;
    }

    public void setItems(List<Item> items) {
        this.items = items;
    }

    public static class Item {
        /**
         * Jenkins Job 名称
         */
        private String name;
        /**
         * ftl 相对路径名 ex: build
         */
        private String templateResource;
        /**
         * ftl 参数
         */
        private Map<?, ?> templateParams;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getTemplateResource() {
            return templateResource;
        }

        public void setTemplateResource(String templateResource) {
            this.templateResource = templateResource;
        }

        public Map<?, ?> getTemplateParams() {
            return templateParams;
        }

        public void setTemplateParams(Map<?, ?> templateParams) {
            this.templateParams = templateParams;
        }
    }
}
